package longrise.phone.com.bjjt_jyb.Adapter;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import java.util.ArrayList;

import longrise.phone.com.bjjt_jyb.R;
import longrise.phone.com.bjjt_jyb.Utils.ImageLoaderForSettingUtils;

/**
 * Created by Administrator on 2016/7/27.
 */
public class CarLossAdapter extends BaseAdapter {
    private Context mContext;
    private ArrayList<String> itemsicon3;
    public CarLossAdapter(Context context,ArrayList<String> itemsicon4) {//coin 用于标识是对方还是本方。1是对方
        this.itemsicon3 = itemsicon4;
        this.mContext=context;
    }

    @Override
    public int getCount() {
        if(itemsicon3.size()<3){
            return itemsicon3.size() + 1;
        }else {
            return itemsicon3.size();
        }
    }

    @Override
    public Object getItem(int i) {
        return itemsicon3.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(final int i, View view, ViewGroup viewGroup) {
        View v = View.inflate(mContext, R.layout.gv_item, null);
        ImageView iv_icon = (ImageView) v.findViewById(R.id.iv_icon);
        if (i < itemsicon3.size()) {
            ImageLoaderForSettingUtils.getInstance(mContext).displayFromSDCard(itemsicon3.get(i),iv_icon);
        }
        return v;
    }
}
